# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version Oct 26 2018)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import wx

import sys
import platform
import psutil


###########################################################################
## Class MyFrame1
###########################################################################

class pc_info(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition,
                          size=wx.Size(800, 600), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        bSizer1.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer2 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer2.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText18 = wx.StaticText(self, wx.ID_ANY, u"计算机名称：", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText18.Wrap(-1)

        bSizer2.Add(self.m_staticText18, 0, wx.ALL, 5)

        self.m_name = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_name.Wrap(-1)

        bSizer2.Add(self.m_name, 0, wx.ALL, 5)

        bSizer2.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer2, 1, wx.EXPAND, 5)

        bSizer3 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer3.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText20 = wx.StaticText(self, wx.ID_ANY, u"计算机操作系统", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText20.Wrap(-1)

        bSizer3.Add(self.m_staticText20, 0, wx.ALL, 5)

        self.m_os = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_os.Wrap(-1)

        bSizer3.Add(self.m_os, 0, wx.ALL, 5)

        bSizer3.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer3, 1, wx.EXPAND, 5)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer4.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText22 = wx.StaticText(self, wx.ID_ANY, u"域名", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText22.Wrap(-1)

        bSizer4.Add(self.m_staticText22, 0, wx.ALL, 5)

        self.m_DNS = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_DNS.Wrap(-1)

        bSizer4.Add(self.m_DNS, 0, wx.ALL, 5)

        bSizer4.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer4, 1, wx.EXPAND, 5)

        bSizer5 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer5.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText24 = wx.StaticText(self, wx.ID_ANY, u"系统制造商", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText24.Wrap(-1)

        bSizer5.Add(self.m_staticText24, 0, wx.ALL, 5)

        self.m_builder = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_builder.Wrap(-1)

        bSizer5.Add(self.m_builder, 0, wx.ALL, 5)

        bSizer5.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer5, 1, wx.EXPAND, 5)

        bSizer6 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer6.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText27 = wx.StaticText(self, wx.ID_ANY, u"系统信号", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText27.Wrap(-1)

        bSizer6.Add(self.m_staticText27, 0, wx.ALL, 5)

        self.m_type = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_type.Wrap(-1)

        bSizer6.Add(self.m_type, 0, wx.ALL, 5)

        bSizer6.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer6, 1, wx.EXPAND, 5)

        bSizer7 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer7.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText29 = wx.StaticText(self, wx.ID_ANY, u"处理器数", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText29.Wrap(-1)

        bSizer7.Add(self.m_staticText29, 0, wx.ALL, 5)

        self.m_numCpu = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_numCpu.Wrap(-1)

        bSizer7.Add(self.m_numCpu, 0, wx.ALL, 5)

        bSizer7.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer7, 1, wx.EXPAND, 5)

        bSizer8 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer8.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText31 = wx.StaticText(self, wx.ID_ANY, u"处理器", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText31.Wrap(-1)

        bSizer8.Add(self.m_staticText31, 0, wx.ALL, 5)

        self.m_cpu = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_cpu.Wrap(-1)

        bSizer8.Add(self.m_cpu, 0, wx.ALL, 5)

        bSizer8.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer8, 1, wx.EXPAND, 5)

        bSizer9 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer9.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText33 = wx.StaticText(self, wx.ID_ANY, u"内存", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText33.Wrap(-1)

        bSizer9.Add(self.m_staticText33, 0, wx.ALL, 5)

        self.m_mem = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_mem.Wrap(-1)

        bSizer9.Add(self.m_mem, 0, wx.ALL, 5)

        bSizer9.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer9, 1, wx.EXPAND, 5)

        bSizer10 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer10.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText35 = wx.StaticText(self, wx.ID_ANY, u"剩余物理内存", wx.DefaultPosition, wx.Size(120, -1), 0)
        self.m_staticText35.Wrap(-1)

        bSizer10.Add(self.m_staticText35, 0, wx.ALL, 5)

        self.m_remainMem = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_remainMem.Wrap(-1)

        bSizer10.Add(self.m_remainMem, 0, wx.ALL, 5)

        bSizer10.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer10, 1, wx.EXPAND, 5)

        bSizer1.Add((0, 0), 1, wx.EXPAND, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)
        self.getSysInfo()

    def __del__(self):
       pass


    def getSysInfo(self):
        if (sys.platform == "win32"):
            import wmi
            Wmi = wmi.WMI()
            CS = Wmi.Win32_ComputerSystem()[0]
            CPU = Wmi.Win32_Processor()[0]
            OS = Wmi.Win32_OperatingSystem()[0]


            self.m_name.SetLabel(platform.node())
            self.m_os.SetLabel(platform.system())

            self.m_DNS.SetLabel(CS.Domain)
            self.m_builder.SetLabel(CS.Manufacturer)
            self.m_type.SetLabel(CS.Model)
            self.m_numCpu.SetLabel(str(psutil.cpu_count()))

            self.m_cpu.SetLabel(CPU.name)
            self.m_mem.SetLabel(str(
                int(CS.TotalPhysicalMemory) // 1024 ** 2) + u"MB")
            self.m_remainMem.SetLabel(str(
                int(OS.FreePhysicalMemory) // 1024) + u"MB")

class myapp(wx.App):
    def OnInit(self):
        myframe = pc_info(None)
        myframe.Show(True)
        return True


if __name__ == '__main__':
    app = myapp()
    app.MainLoop()
